package com.bdcom.comp;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bdcom.dialog.UpdateDevicePropertyDialog;
import com.bdcom.util.PlannerUtil;
@Component
public class DevicePopUpMenu extends JPopupMenu implements ActionListener{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private JMenuItem updateDeviceProperty=null;

	@Autowired
	private UpdateDevicePropertyDialog updateDevicePropertyDialog; 

	public DevicePopUpMenu() {
		super();
		// TODO Auto-generated constructor stub
		
		add(updateDeviceProperty=new JMenuItem(PlannerUtil.getString("updateDeviceProperty")));
		
		updateDeviceProperty.setActionCommand(PlannerUtil.UPDATE_DEVICE_PROPERTY);
		
		updateDeviceProperty.addActionListener(this);
		
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		// TODO Auto-generated method stub
		String cmd=e.getActionCommand();
		
		if (PlannerUtil.UPDATE_DEVICE_PROPERTY.equals(cmd)) {
			
			updateDevicePropertyDialog.setVisible(true);
		}
	}

}
